#include "Common.h"

class TTSDataGram
{
    private:
        uint32 _id;
        uint32 _command;
        uint32 _bodyLen;

        byte* _body;

        TTSDataGram(const TTSDataGram&);

        TTSDataGram& operator = (const TTSDataGram&);

    public:
        TTSDataGram()
            :_id(0), _command(0),
             _bodyLen(0), _body(NULL)
        { }

        ~TTSDataGram()
        {
            delete [] _body;
        }

        uint32 GetID() const { return _id; }

        uint32 GetCommand() const { return _command; }

        uint32 GetBodyLen() const { return _bodyLen; }

        byte* GetBody() const { return _body; }

        void SetID(uint32 id) { _id = id; }

        void SetCommand(uint32 command) { _command = command; }

        void SetBodyAndLen(uint32 bodyLen)
        {
            if (_body != NULL)
            {
                delete [] _body;
            }

            _bodyLen = bodyLen;
            _body = _bodyLen == 0 ? NULL : new byte[_bodyLen];
        }

};
